/*
 * constants.h
 *
 *  Created on: Jul 11, 2009
 *      Author: mosh
 */

#ifndef CONSTANTS_H_
#define CONSTANTS_H_

#include<string>
#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <fstream>

#define I_NODE_SIZE 56
#define NO_FREE_BLOCKS -2
#define NO_FREE_INODES -3
#define NORMAL 1
#define DIRECTORY 2
#define SOFT_LINK 3
#define NO_TYPE 0
#define NONE -4
#define NUM_OF_DIRECT 10
#define NAME_SIZE 12
#define NOT_A_NORMAL_FILE -5
#define NOT_A_DIRECTORY -6
#define TRY_TO_DELETE_ROOT -7
#define OPEN_FDT_SIZE 128

using namespace std;

typedef struct general_data general_data;
typedef struct inode inode;
typedef struct directory_entry directory_entry;
typedef struct list list;
typedef struct fdt_entry fdt_entry;
typedef fdt_entry* fd_table;
enum type{Directory,SoftLink,Normal,NoType};

struct general_data{

	int numOfBlocks;
	int blk_size;
	int iNodes;
	int free_blocks;
	int free_iNodes;
	int first_free_block;
	int last_free_block;
	int first_free_iNode;
	int last_free_iNode_blk;
	int root_iNode;
};

struct inode{

	int file_size;
	int direct[NUM_OF_DIRECT];
	int in_direct;
	type itype;
	int num_of_hard_link;
};

struct directory_entry{
	int number;
	char name[NAME_SIZE];
};

struct list{
	int number;
	directory_entry *enteries;
};

struct fdt_entry{
	int iNode;
	int fp;
	int mod;
};

void printInode(inode*node);

inode *createInode();



#endif /* CONSTANTS_H_ */
